<?php
namespace app\store\controller\market;
use app\store\controller\Controller;
use app\store\model\Winad as WinadModel;



/**
 * 广告控制器
 * Class Clerk
 * @package app\store\controller\marke\winad
 */
class Winad extends Controller
{
    /**
     * 
     * @param int $ad_id
     * @param string $search
     * @return mixed
     * @throws \think\exception\DbException
     */
    public function index()
    {
       
        $model = WinadModel::detail(1);
        if (!$this->request->isAjax()) {
            return $this->fetch('index', compact('model'));
        }
        // 更新记录
        if ($model->index($this->postData('win_ad'))) {
            return $this->renderSuccess('更新成功', url('market.winad/index'));
        }
        return $this->renderError($model->getError() ?: '更新失败');
    }
}